<%@ page language="java" contentType="text/html; charset=UTF-8"
  pageEncoding="UTF-8"%>
<%@page import="com.sinopec.siam.agent.metadata.provider.FileBackedHTTPMetadataProviderExt"%>
<%@page import="com.sinopec.siam.agent.sp.config.SysConfig"%>
<%@page import="com.sinopec.siam.agent.web.WebApplicationContextUtils"%>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" lang="zh-CN">
<head>
    <title>统一身份集成示例</title>
    <meta http-equiv="content-type" content="text/html; charset=utf-8"/>
    <meta name="keywords" content="用户, 统一身份, 账号, 认证"/>
    <meta name="description" content="中国石化用户统一身份认证中心"/>
</head>
<body>
<div id="container">
    <%
	int id = Integer.parseInt("".equals(request.getParameter("id"))||request.getParameter("id") ==null?"0":request.getParameter("id")); 
  	if(SysConfig.ts_metadata_down_auto){
	  	try{
		  	FileBackedHTTPMetadataProviderExt fbpsp = (FileBackedHTTPMetadataProviderExt)WebApplicationContextUtils.getBean("siam.sp.metadata.provider");
		  	if(id == 0){
		  		fbpsp.clearBackFile();
		  	}
	  		fbpsp.refresh(id);
	  	%>
	  	<p><%
	  	
		  	if(id == 0){
		  		out.print("sp-metadata下载成功,下载路径：" + (SysConfig.sp_metadata_backUpPath).replace( "/" , "\\").substring(1, SysConfig.sp_metadata_backUpPath.length())); 
		  	}else if(id == 2){
		  		out.print("sp-metadata加载成功,加载路径：" + (SysConfig.sp_metadata_backUpPath).replace( "/" , "\\").substring(1, SysConfig.sp_metadata_backUpPath.length()));
		  	}
	  	%></p>
	  	<%
	  	}catch(Exception e){
	  	%>
	  		<p><%
	  		if(id == 0){
	  			out.print("sp-metadata下载失败"+e.toString());
	  		}else if(id == 2){
	  			out.print("sp-metadata加载失败"+e.toString());
	  		}
	  		%></p>
	  	<%	
	  	}
  	}else{
  		out.print("metadata file auto download =false");
  	}
  	%>
  	<%
  	if(SysConfig.ts_metadata_down_auto){
  	try{
		FileBackedHTTPMetadataProviderExt fbpidp = (FileBackedHTTPMetadataProviderExt)WebApplicationContextUtils.getBean("siam.idp.metadata.provider");
		if(id == 0){
			fbpidp.clearBackFile();
		}
		fbpidp.refresh(id);
  	%>
  	<p><%
  	if(SysConfig.ts_metadata_down_auto){
	  	if(id == 0){
	  		out.print("idp-metadata下载成功,下载路径：" + (SysConfig.idp_metadata_backUpPath).replace( "/" , "\\").substring(1, SysConfig.idp_metadata_backUpPath.length())); 
	  	}else if(id == 2){
	  		out.print("idp-metadata加载成功,加载路径：" + (SysConfig.idp_metadata_backUpPath).replace( "/" , "\\").substring(1, SysConfig.idp_metadata_backUpPath.length()));
	  	}
  	}else{
  		out.print("metadata file auto download =false");
  	}
  	%></p>
  	<%
  	}catch(Exception e){
  	%>
  		<p><%
  		if(id == 0){
  			out.print("idp-metadata下载失败"+e.toString());
  		}else if(id == 2){
  			out.print("idp-metadata加载失败"+e.toString());
  		}
  		%></p>
  	<%	
  	}}
  	%>
  	
  </div>
</body>
</html>
